#include <iostream>
using namespace std;

class Person{
public:
  virtual Person& BuyTicket{
    cout << "全价买票:" << endl;
    return *this;
  }
};

class Student : public Person{
public:
  virtual Student& BuyTicket(int nu = 1){
    cout << "半价买票:" << nu << endl;
    return *this;
  }
};

class Soldier : public Person{
public:
  virtual Student& BuyTicket(int nu = 2){
    cout << "优先买票:" << nu << endl;
    return *(new Student);
  }
};

void Func(Person &pp){
  pp.BuyTicket();
}

int main(){
  Person ps;
  Student st;
  Soldier sd;

  Func(ps);
  Func(st);
  Func(sd);
  return 0;
}
